<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>错误页面</title>
    <style>
        span{
            color: aqua;
            font-size:25px;
            display: inline-block;
        }
        span:hover{
            cursor: pointer;
            color: blue;
        }
        button:hover{
            cursor: pointer;
            color: rgb(243, 11, 30);
        }
    </style>
</head>
<body>
    <h1>{{msg?msg:'错误页面'}}</h1>
    <h2>{{err?err:""}}</h2>
    <span onclick="fun()">6秒后返回上个页面</span>
    <button onclick="cancleFun()">取消</button>

    <script>
        let span = document.querySelector('span');
        let time=6;
        let timer = setInterval(function(){
            if(time>0){
                time--;
                span.innerHTML = `${time}秒后返回上个页面`
            }else{
                window.history.back();
            }
        },1000)
        function cancleFun(){
            clearInterval(timer);
            // alert("asdas")
        }
        // setTimeout(function(){
        //     // location.href="login"
        //     window.history.back();  
        // },6000)
        function fun(){
            window.history.back();  
        }
    </script>
</body>
</html>